<?php session_start();
/**
 * Created by IntelliJ IDEA.
 * User: m1573
 * Date: 2022/7/14
 * Time: 18:41
 */
include ("include/util.inc.php");
$category = $_GET["category"];
$level = $_GET["level"];
$size = $_GET["size"];
$mode = $_GET["mode"];
$mode2 = $_GET["mode2"];


$time = 0;
$index = 0;
if(strcmp($mode,'time')==0){
    $time = $_GET["time"];
}



$res =  select($PDO,$category,$level,$size,$mode2);
$username = $_SESSION["username"];
?>


<head>
    <title>index</title>
    <link rel="stylesheet" rev="stylesheet" href="static/css/all.css" type="text/css" media="all">

    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <link rel="stylesheet" href="static/css/bootstrap.min.css" type="text/css">
    <script type="text/javascript" src="static/js/jquery.js"></script>
    <script type="text/javascript" src="static/js/bootstrap.js"></script>
</head>
<body class="bg">
<input type="hidden" value="<?=$mode?>" id="mode">
<input type="hidden" value="<?=$time?>" id="time">
<input type="hidden" value="<?=$username?>" id="username">
<div id="questions">
<?php
       while($row=$res->fetch()){
            $question = $row["question_part"];
            $level = $row["level_part"];
            $category= $row["category"];
            $qid = $row["qid"];
        ?>

<div class="modal-dialog" id="<?=$index?>" style="visibility: hidden">
    <div class="modal-content">
        <div class="modal-header">
            <h5 class="modal-title">
                <?=$index+1?>  <?=$category?>-<?=$level?>
            </h5>
            <h5 class="pull-right" id="countdown"></h5>
        </div>
        <div class="modal-body">
            <div class="mb-3 row">
                <div class="col-sm-6 " id="categorydiv">
                    <label class="col-sm-2 col-form-label"><strong>question</strong></label>
                </div>
                <input type="hidden" value="<?=$qid?>"  class="qid">
            </div>
            <div class="mb-3 row">
                    <div class="form-group col-sm-12">
                        <label style="text-indent: 2em"><?=$question?></label>
                    </div>
            </div>

            <div class="mb-3 row">
                <div class="form-group">
                    <input type="text" class="form-control answer"   placeholder="please enter the answer" >
                </div>
            </div>

        </div>
        <div class="modal-footer ">
            <button type="button" class="btn btn-success text-center" onclick="click_next()">Next</button>
        </div>


    </div>

</div>

    <?php
           $index = $index + 1;
       }
       ?>
</div>

<input type="hidden" value="<?=$index?>" id="num">
</body>
<script type="text/javascript" src="static/js/question.js"></script>
<script>

</script>
